/**
 * IsysRoleService.java
 * Created at 2017-2-7
 * Created by shihui
 * Copyright (C) 2017 BROADTEXT SOFTWARE, All rights reserved.
 */
package com.broadtext.rms.system.service;

import java.util.List;
import java.util.Map;

import com.broadtext.common.bean.EntityPageBean;
import com.broadtext.common.exp.DaoException;
import com.broadtext.common.exp.ServiceException;
import com.broadtext.common.service.IEntityService;
import com.broadtext.rms.system.model.SysRole;
import com.broadtext.rms.system.model.SysUserRole;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;

/**
 * <p>ClassName: ISysRoleService</p>
 * <p>Description: 角色管理服务接口类</p>
 * <p>Author: shihui</p>
 * <p>Date: 2017-2-7</p>
 */
public interface ISysRoleService extends IEntityService<SysRole>  {

    /**
     * 
     * <p>Description: 查询角色列表</p>
     * @return 角色
     * @throws DaoException dao异常
     */
    List<SysRole> getRolesTree() throws DaoException;

    /**
     * 
     * <p>Description: 根据条件查询角色下的人员</p>
     * @param map 查询条件
     * @param pageBounds 翻页
     * @return 人员列表
     * @throws ServiceException 异常
     */
    EntityPageBean<Object> findUserByRole(Map<String, Object> map, PageBounds pageBounds) throws ServiceException;

    /**
     * 
     * <p>Description: 删除（伪）角色</p>
     * @param map 角色信息
     * @throws ServiceException 异常
     */
    void delRole(Map<String, Object> map) throws ServiceException;

    /**
     * 
     * <p>Description: 锁定角色</p>
     * @param map 角色信息
     * @throws ServiceException 异常
     */
    void lockRole(Map<String, Object> map) throws ServiceException;

    /**
     * 
     * <p>Description: 删除角色用户</p>
     * @param map 角色和用户信息
     * @throws ServiceException 异常
     */
    void deleteUserFromRole(Map<String, Object> map) throws ServiceException;

    /**
     * 
     * <p>Description: 向角色添加用户</p>
     * @param list 添加记录
     * @throws ServiceException 异常
     */
    void addUsersToRole(List<SysUserRole> list) throws ServiceException;

    /**
     * 
     * <p>Description: 查询新增角色是否已存在</p>
     * @param role 角色实体
     * @return 查询结果
     * @throws ServiceException 异常
     */
    SysRole findRoleExist(SysRole role) throws ServiceException;

    /**
     * 
     * <p>Description: 根据角色查询资源</p>
     * @param id 角色ID
     * @return 资源
     * @throws ServiceException 异常
     */
    List<String> findResourceByRole(String id) throws ServiceException;

    /**
     * 
     * <p>Description: 保存角色资源</p>
     * @param roleId 角色ID
     * @param res 资源
     * @return 操作结果
     * @throws ServiceException 异常
     */
    void saveRoleResource(String roleId, String[] res) throws ServiceException;

}
